//
//  WDArrivalServiceViewModel.m
//  wd-serviceapp
//
//  Created by Bin Tang on 2024/8/2.
//

#import "WDArrivalServiceViewModel.h"

@implementation WDArrivalServiceViewModel

- (void)initialize
{
    [super initialize];
    
    self.title = @"到站服务";
    
    _reqModel = [WDArrivalScanCarReqModel new];
    
    
    
}


/// 扫码车辆请求接口
/// - Parameter completion: completion description
- (void)requestWithScanCar:(RequestCompletionBlock)completion {
    @weakify(self);
    _reqModel.engineerId = @([EDSAppDelegateTool sharedInstance].userInfoModel.userId);
    _reqModel.stationId = @([EDSAppDelegateTool sharedInstance].userInfoModel.stationId);
    _reqModel.scanAddress = [WDLocationManager shareInstance].address;
    _reqModel.scanLatitude = @([WDLocationManager shareInstance].lastLocation.coordinate.latitude);
    _reqModel.scanLongitude = @([WDLocationManager shareInstance].lastLocation.coordinate.longitude);
    
    WDArrivalScanCarRequest *request = [[WDArrivalScanCarRequest alloc] initWithModel:self.reqModel];
    [request startWithCompletionBlockWithSuccess:^(__kindof TYZBaseRequest * _Nonnull request) {
        @strongify(self);
        
        [self sendResponseObject:request.responseModelObject completion:completion];
    } failure:^(__kindof TYZBaseRequest * _Nonnull request) {
        @strongify(self);
        [self sendResponseObject:request.responseModelObject completion:completion];
    }];
}

@end
